<template>
  <div class="ele-body">
    <el-card shadow="never">

      <!-- 搜索表单 -->
      <el-form style="margin-top: 10px"
               :model="where"
               label-width="77px"
               class="ele-form-search"
               @keyup.enter.native="reload"
               @submit.native.prevent>
        <el-row :gutter="15">
          <el-col :lg="6" :md="12">
            <el-form-item label="订单编号:">
              <el-input
                v-model="where.OrderId"
                placeholder="请输入订单编号"
                clearable/>
            </el-form-item>

          </el-col>
          <el-col :lg="6" :md="12">
            <el-form-item label="游戏ID:">
              <el-input
                v-model="where.UserId"
                placeholder="请输入游戏ID"
                clearable/>
            </el-form-item>

          </el-col>
          <el-col :lg="6" :md="12">
            <el-form-item label="兑换渠道:">
              <el-input
                v-model="where.ChannelID"
                placeholder="请输入兑换渠道"
                clearable/>
            </el-form-item>
          </el-col>
          <el-col :lg="6" :md="12">
            <el-form-item label="渠道类型:">
              <el-input
                v-model="where.ChannelID"
                placeholder="请选择兑换渠道类型"
                clearable/>
            </el-form-item>
          </el-col>
          <el-col :lg="6" :md="12">
            <el-form-item label="渠道类型:">
              <el-input
                v-model="where.ChannelID"
                placeholder="请选择兑换渠道类型"
                clearable/>
            </el-form-item>
          </el-col>
          <el-col :lg="6" :md="12">
            <el-form-item label="开始时间:">
              <el-date-picker
                type="datetime"
                class="ele-fluid"
                v-model="where.startTime"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="请选择开始时间"/>
            </el-form-item>
          </el-col>
          <el-col :lg="6" :md="12">
            <el-form-item label="结束时间:">
              <el-date-picker
                type="datetime"
                class="ele-fluid"
                v-model="where.endTime"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="请选择结束时间"/>
            </el-form-item>
          </el-col>
          <el-col :lg="6" :md="12" >
            <div class="ele-form-actions">
              <el-button
                type="primary"
                @click="reload"
                icon="el-icon-search"
                class="ele-btn-icon">查询
              </el-button>
              <el-button @click="reset">重置</el-button>
            </div>
          </el-col>
        </el-row>
      </el-form>

      <!-- 数据表格 -->
      <ele-pro-table
        ref="table"
        :datasource="url"
        :columns="columns"
        :where="where"
        :page-size="20"
        height="calc(100vh - 315px)">

        <!-- 表头工具栏 -->
        <!--        <template slot="toolbar">-->
        <!--          <el-button-->
        <!--            @click="exportData"-->
        <!--            type="primary"-->
        <!--            icon="el-icon-download"-->
        <!--            class="ele-btn-icon"-->
        <!--            size="small"-->
        <!--            v-if="permission.includes('sys:loginlog:export')">导出-->
        <!--          </el-button>-->
        <!--        </template>-->
        <!-- 操作类型列 -->
        <!-- 操作列 -->
        <!--        <template slot="action" slot-scope="{row}">-->
        <!--          <el-link-->
        <!--            type="primary"-->
        <!--            :underline="false"-->
        <!--            icon="el-icon-edit"-->
        <!--            @click="openEdit(row)"-->
        <!--            v-if="permission.includes('sys:channel:edit')">修改-->
        <!--          </el-link>-->

        <!--        </template>-->
      </ele-pro-table>
    </el-card>

    <!-- 编辑弹窗 -->
    <channel-edit
      :data="current"
      :visible.sync="showEdit"
      @done="reload"/>
  </div>
</template>

<script>
import {mapGetters} from "vuex";
import ChannelEdit from './exchange-edit.vue';


export default {
  name: 'SystemPayOrder',
  components: {ChannelEdit},
  computed: {
    ...mapGetters(["permission"]),
  },
  data() {
    return {
      // 表格数据接口
      url: '/admin/order.payOrder/index',
      // 表格列配置
      columns: [
        {
          columnKey: 'selection',
          type: 'selection',
          width: 45,
          align: 'center',
          fixed: "left"
        },
        {
          prop: 'OrderId',
          label: '订单编号',
          width: 200,
          align: 'center',
          showOverflowTooltip: true,
          fixed: "left"
        },
        {
          prop: 'UserId',
          label: '游戏ID',
          width: 100,
          align: 'center',
          showOverflowTooltip: true,
          fixed: "left"
        },
        {
          prop: 'Amount',
          label: '充值金额',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 100
        },

        {
          prop: 'OrderStatus',
          label: '订单状态',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 100
        },

        {
          prop: 'OrderDate',
          label: '下单时间',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 180
        },
        {
          prop: 'FinishDate',
          label: '付款时间',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 180
        },
        {
          prop: 'PhoneTypes',
          label: '设备类型',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 100,
          formatter: (row, column, cellValue) => {
            if (cellValue == 0) {
              return '安卓'
            }
            return 'IPhone'
          }
        },
        {
          prop: 'OrderTypes',
          label: '支付类型',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 100
        },
        {
          prop: 'PayAccount',
          label: '收款GCash号',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 100
        },
        {
          prop: 'RefNo',
          label: 'Gcash订单号',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 100
        },
        {
          prop: 'PayAccount',
          label: '付款Gcash账号',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 100
        },
        {
          columnKey: 'action',
          label: '操作',
          width: 90,
          align: 'center',
          resizable: false,
          slot: 'action',
          fixed: "right"
        }
      ],
      // 表格搜索条件
      where: {},
      // 当前编辑数据
      current: null,
      // 是否显示编辑弹窗
      showEdit: false,
      // 筛选日期范围
      // daterange: null,
      // 日期时间选择器快捷项
    };
  },
  methods: {
    /* 刷新表格 */
    reload() {
      this.$refs.table.reload({where: this.where});
    },
    /* 重置搜索 */
    reset() {
      this.where = {};
      this.daterange = null;
      this.reload();
    },
    openEdit(row) {
      console.log(row)
      this.current = row;
      this.showEdit = true;
    },
    /* 日期选择改变回调 */
  }
}
</script>

<style scoped>
</style>
